﻿<Common:LayoutAwarePage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:common="using:Antares.Common"
    xmlns:VIEWs="using:Antares.VIEWs" xmlns:VIEWMODELs="using:Antares.VIEWMODELs"
     xmlns:Common="using:AntaresShell.Common" xmlns:Input="using:Telerik.UI.Xaml.Controls.Input"
    xmlns:Globalization="using:System.Globalization" x:Name="pageRoot"
    x:Class="Antares.VIEWs.BasicMonthPage"
    mc:Ignorable="d">
    <Common:LayoutAwarePage.Transitions>
        <TransitionCollection>
            <EntranceThemeTransition/>
        </TransitionCollection>
    </Common:LayoutAwarePage.Transitions>
    
    <Common:LayoutAwarePage.Resources>
        <Style x:Key="HeaderStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="Foreground" Value="#FF363636"/>
            <Setter Property="FontSize" Value="28"/>
            <Setter Property="Transitions">
                <Setter.Value>
                    <TransitionCollection>
                        <ContentThemeTransition/>
                    </TransitionCollection>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!--<Style x:Key="GridTransition" TargetType="GridView">
            <Setter Property="Transitions">
                <Setter.Value>
                    <TransitionCollection>
                        <EdgeUIThemeTransition/>
                    </TransitionCollection>
                </Setter.Value>
            </Setter>
        </Style>-->

        <DataTemplate
                x:Key="DayItemTemplate">
            <VIEWs:DayItem2/>
        </DataTemplate>
    </Common:LayoutAwarePage.Resources>

    <Common:LayoutAwarePage.Background>
        <ImageBrush/>
    </Common:LayoutAwarePage.Background>

    <Common:LayoutAwarePage.DataContext>
        <VIEWMODELs:BasicMonthViewModel/>
    </Common:LayoutAwarePage.DataContext>

    <Grid Background="#FFEDEDED">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Background="White">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Text="{Binding CurrentMonth}" Style="{StaticResource PageHeaderTextStyle}" Grid.Column="1" IsHitTestVisible="false"/>
            <TextBlock x:Name="currentYear" HorizontalAlignment="Right" Text="{Binding CurrentYear}" Style="{StaticResource PageHeaderTextStyle}" FontSize="78" Foreground="Gray" Opacity="0.6" Grid.Column="1" IsHitTestVisible="false"/>
        </Grid>

        <Grid Grid.Row="1" x:Name="DynamicArea" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="100"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition x:Name="Test" Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                
            </Grid.ColumnDefinitions>
            <Rectangle Fill="LightBlue" Grid.RowSpan="3" Grid.Column="0"/>
            <TextBlock Text="{Binding Resource[DOW_2]}" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_3]}" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_4]}" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_5]}" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_6]}" Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_7]}" Grid.Column="6" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>
            <TextBlock Text="{Binding Resource[DOW_1]}" Grid.Column="7" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource HeaderStyle}"/>

            <GridView x:Name="Calendar" 
    			Grid.Row="1" 
    			Grid.Column="1" 
    			ScrollViewer.HorizontalScrollBarVisibility="Disabled"
    			Grid.ColumnSpan="7" 
    			SelectionMode="None"
    			ItemsSource="{Binding SingleMonth}"
                     ItemContainerStyle="{StaticResource GridViewMonthItem}"
    			ItemTemplate="{StaticResource DayItemTemplate}">
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VariableSizedWrapGrid 
    						ScrollViewer.HorizontalScrollBarVisibility="Disabled"
    						Margin="0,0,-10,-5"
    						Orientation="Horizontal"
    						ItemWidth="{Binding ActualWidth, ElementName=Test}"/>
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
            </GridView>

            <Button Grid.Column="1" Grid.Row="2" 
    			x:Name="PreviousButton" Style="{StaticResource PreviousAppBarButtonStyle2}" 
    			VerticalAlignment="Top" HorizontalAlignment="Left"
    			Command="{Binding PreviousCommand}" Foreground="#FF464646"
                    AutomationProperties.Name=""/>

            <Button Grid.Column="7" Grid.Row="2" 
    			x:Name="NextButton" Style="{StaticResource NextAppBarButtonStyle2}" 
    			VerticalAlignment="Top" HorizontalAlignment="Right"
    			Command="{Binding NextCommand}" Foreground="#FF464646"
                    AutomationProperties.Name=""/>
            <StackPanel Grid.Column="5" Grid.ColumnSpan="2" Grid.Row="2" >
            <TextBlock Text="{Binding Resource[Goto]}"  FontFamily="Segoe UI" FontSize="18" FontWeight="Light"></TextBlock>
                <Input:RadDatePicker  x:Name="GotoDate"/>
            </StackPanel>

        </Grid>
    </Grid>
</Common:LayoutAwarePage>